package com.tanhua.manage.controller;

import com.tanhua.manage.service.AnalysisService;
import com.tanhua.manage.vo.AnalysisSummaryVo;
import com.tanhua.manage.vo.AnalysisUsersVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AnalysisController {

    @Autowired
    private AnalysisService analysisService;

    /**
     * 概要统计信息
     * @return
     */
    @GetMapping("/dashboard/summary")
    public ResponseEntity AnalysisSummary() {
        return ResponseEntity.ok(analysisService.queryAnalysisSummary());
    }


    /**
     * 新增、活跃用户、次日留存率
     */
    @GetMapping("/dashboard/users")
    public ResponseEntity statisticalRetentionRate(Long sd,Long ed,Long type) {
        //调用方法 传入参数 返回AnalysisUsersVo
        AnalysisUsersVo analysisUsersVo= analysisService.statisticalRetentionRate(sd,ed,type);
        //返回状态信息
        return ResponseEntity.ok(analysisUsersVo);
    }

}
